package com.mer.member.controller;

import com.mer.member.entity.Member;
import com.mer.member.service.MemberService;
import com.mer.member.utils.Result;
import com.mer.member.vo.MemberVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: iiphase-project-master
 * @description:
 * @author: 薛宁宁
 * @create: 2021-10-19 15:16
 **/
@RestController
@RequestMapping("/member/member")
@Api(tags = "查询会员信息的API接口")
@CrossOrigin
public class MemberController {
    @Autowired
    private MemberService memberService;

    @ApiOperation("查询会员信息的接口")
    @PostMapping("queryAllMember/{page}/{limit}")
    public Result queryAllMember(@PathVariable("page") Integer page, @PathVariable("limit") Integer limit,
                                 @RequestBody MemberVo memberVo) {
        return memberService.queryAllMember(page, limit, memberVo);
    }

    @ApiOperation("修改会员信息")
    @PostMapping("modifyMember")
    public Result modifyMember(@RequestBody Member member){
        return memberService.modifyMember(member);
    }

    @ApiOperation("修改会员的状态")
    @PostMapping("changeState/{isDisabled}/{id}")
    public Result changeState(@PathVariable("isDisabled") Boolean isDisabled,@PathVariable("id") String id){
        return memberService.changeState(isDisabled,id);
    }



}
